#coding:utf-8

from __future__ import unicode_literals

from django.db import models

# Create your models here.

class BaseModel(models.Model):
    delete_flag = models.CharField(max_length=4, verbose_name='删除标识')

class Users(BaseModel):
    user = models.CharField(max_length=32, verbose_name='登录名')
    password = models.CharField(max_length=32, verbose_name='密码')
    name = models.CharField(max_length=32, verbose_name='用户名')
    city = models.CharField(max_length=32, verbose_name='城市')
    email = models.EmailField(verbose_name='邮箱')
    phone = models.CharField(max_length=32, verbose_name='电话')

class Group(BaseModel):
    Name = models.CharField(max_length=32, verbose_name='组名')
    Description = models.TextField(verbose_name='描述')

class Permission(BaseModel):
    Name = models.CharField(max_length=32, verbose_name='权限名称')
    Description = models.TextField(verbose_name='描述')

class User_Group(BaseModel):
    userID = models.IntegerField(verbose_name='用户ID')
    groupID = models.IntegerField(verbose_name='组ID')

class User_Permission(BaseModel):
    userID = models.IntegerField(verbose_name='用户ID')
    permissionID = models.IntegerField(verbose_name='权限ID')

class Permission_Group(BaseModel):
    userID = models.IntegerField(verbose_name='权限ID')
    groupID = models.IntegerField(verbose_name='组ID')


class Servers(BaseModel):
    hostname = models.CharField(max_length=32, verbose_name='主机名')
    ip = models.CharField(max_length=32, verbose_name='IP地址')
    mac = models.CharField(max_length=32, verbose_name='物理地址')
    cpu = models.CharField(max_length=32, verbose_name='处理器')
    mem = models.CharField(max_length=32, verbose_name='内存')
    disk = models.CharField(max_length=32, verbose_name='硬盘')
    system = models.CharField(max_length=32, verbose_name='系统')
    io = models.CharField(max_length=32, verbose_name='IO')
    lastLogin = models.CharField(max_length=32, verbose_name='上次登录时间')
    lastLoginUser = models.CharField(max_length=32, verbose_name='上次登录用户')
    isActive = models.CharField(max_length=32, verbose_name='是否激活')

class ServerGroup(BaseModel):
    groupname = models.CharField(max_length=32, verbose_name='组名')
    memberCount = models.IntegerField(verbose_name='成员数量')
    description = models.TextField(verbose_name='描述')


class Server_Group(BaseModel):
    serverID = models.IntegerField(verbose_name='服务器ID')
    serverGroupID = models.IntegerField(verbose_name='服务器组ID')


class UserServer(BaseModel):
    userID = models.IntegerField()
    serID = models.IntegerField()

